<?php

namespace App\Listeners;

use App\Events\EventOrderGoodsInventoryCarryingDetail;
use App\Services\Warehouse\OrderGoodsInventoryCarryingDetailService;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class EventListenerOrderGoodsInventoryCarryingDetail
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public $OrderGoodsInventoryCarryingDetailService;
    public function __construct(OrderGoodsInventoryCarryingDetailService $orderGoodsInventoryCarryingDetailService)
    {
        $this->OrderGoodsInventoryCarryingDetailService=$orderGoodsInventoryCarryingDetailService;
    }

    /**
     * Handle the event.
     *
     * @param  EventOrderGoodsInventoryCarryingDetail  $event
     * @return void
     */
    public function handle(EventOrderGoodsInventoryCarryingDetail $event)
    {
        $order=$event->OrderGoodsInventoryCarryingDetail;
        if(!empty($order['order_id'])){
            $data=[
                'order_id'=>$order['order_id'],
                'o_status'=>1
            ];
            $this->OrderGoodsInventoryCarryingDetailService->UpdateO_statusBatch($data);
            return true;
        }else{
            return false;
        }

    }

}
